<%@include file="/WEB-INF/pages/commons/commons.jsp"%>


<jsecurity:lacksPermission name="blog:viewTags:${actionBean.blog.id}">
    No "blog:viewTags:${actionBean.blog.id}" permission
</jsecurity:lacksPermission>

<jsecurity:hasPermission name="blog:viewTags:${actionBean.blog.id}">
<script type="text/javascript">
            $(document).ready(function() {
                $(".edit").click(function(){
                    $("#display").html('<fmt:message key="global.loading"/>');
                    $.get(
                        this,
                        function(data){
                            $("#display").hide();
                            $("#display").html("<h2>Edit <a href='#' onclick='$(\"#display\").hide();'>Close</a></h2>"+data+"<p/></p><p/>");
                            $("#display").fadeIn();
                        }
                    );
                    return false;
                });

                $("#add").click(function(){
                    $("#display").html('<fmt:message key="global.loading"/>');
                    $.get(
                        this,
                        function(data) {
                            $("#display").hide();
                            $("#display").html("<h2>Add <a href='#' onclick='$(\"#display\").hide();'>Close</a></h2>"+data+"<p/><p/><p/>");
                            $("#display").fadeIn();
                        }
                    );
                    return false;
                });
            });
        </script>

<stripes:messages/>
    <stripes:errors/>

<stripes:url var="tableUrl" beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="tags"/>
        <fmt:message var="col_id" key="view_tags_table.jsp.column.id"/>
        <fmt:message var="col_name" key="view_tags_table.jsp.column.name"/>
        <fmt:message var="col_description" key="view_tags_table.jsp.column.description"/>
        <fmt:message var="col_actions" key="view_tags_table.jsp.column.actions"/>


        <jsecurity:hasPermission name="blog:addTag:${actionBean.blog.id}">
        <stripes:link id="add" beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="addTag">
            <stripes:param name="blog" value="${actionBean.blog.id}"/>
            <fmt:message key="view_tags_table.jsp.action.add"/>
        </stripes:link>
        <br/>
        </jsecurity:hasPermission>

        <displaytag:table id="element" name="actionBean.tags.list" sort="external"
                          excludedParams="*"
                          defaultsort="1"
                          defaultorder="ascending"
                          style="width:100%;"
                          requestURI="tableUrl"
                          requestURIcontext="true" >
            <displaytag_el:column property="id" sortable="false" sortName="id" title="${col_id}"  />
            <displaytag_el:column property="name" sortable="false" sortName="name" title="${col_name}" />
            <displaytag_el:column property="description" sortable="false" sortName="description" title="${col_description}" />
            <displaytag_el:column title="${col_actions}">
                <jsecurity:hasPermission name="blog:editTag:${actionBean.blog.id}">
                <stripes:link class="edit" beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="editTag">
                    <stripes:param name="tag" value="${element.id}"/>
                    <stripes:param name="blog" value="${element.blog.id}"/>
                    <fmt:message key="view_tags_table.jsp.action.edit"/>
                </stripes:link>
                </jsecurity:hasPermission>
                <jsecurity:hasPermission name="blog:deleteTag:${actionBean.blog.id}">
                |&nbsp;<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="deleteTag">
                    <stripes:param name="tag" value="${element.id}"/>
                    <stripes:param name="blog" value="${element.blog.id}"/>
                    <fmt:message key="view_tags_table.jsp.action.remove"/>
                </stripes:link>
                </jsecurity:hasPermission>
            </displaytag_el:column>
        </displaytag:table>
</jsecurity:hasPermission>

